//
//  PlayListTableViewCell.m
//  GC_OC
//
//  Created by wlf on 2022/5/16.
//

#import "PlayListTableViewCell.h"

@implementation PlayListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.titleLab = [[UILabel alloc] initWithFrame:CGRectMake(30, 0, 200, 50)];
        self.titleLab.font = [UIFont systemFontOfSize:14];
        self.titleLab.textColor = [UIColor blackColor];
        self.subTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 45 - 17 - 95, 0, 100, 50)];
        self.subTitleLab.font = [UIFont systemFontOfSize:8];
        self.subTitleLab.textColor = [UIColor colorWithHex:@"#BFBFBF"];
        self.subTitleLab.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:self.titleLab];
        [self.contentView addSubview:self.subTitleLab];
        
        self.topImgV = [[UIImageView alloc] initWithFrame:CGRectMake(5,16, 18, 18)];
        self.topImgV.image = [UIImage imageNamed:@"icon_playIcon"];
        [self.contentView addSubview:self.topImgV];
        self.topImgV.hidden = YES;
        
        self.clearBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 45 - 17, 2.5, 45, 45)];
        [self.clearBtn setImage:[UIImage imageNamed:@"icon_clear"] forState:UIControlStateNormal];
        [self.clearBtn addTarget:self action:@selector(clearBtnClickAction) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.clearBtn];
    }
    return self;
}
- (void)clearBtnClickAction{
    if (self.clearBtnClick) {
        self.clearBtnClick();
    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    if (selected) {
        self.contentView.backgroundColor = [UIColor colorWithHex:@"#E9F9FF"];
        self.titleLab.textColor = [UIColor colorWithRed:0/255.0 green:145/255.0 blue:255/255.0 alpha:1.0];
        self.subTitleLab.textColor = [UIColor colorWithRed:0/255.0 green:145/255.0 blue:255/255.0 alpha:1.0];
        
        self.topImgV.hidden = NO;
        self.titleLab.frame = CGRectMake(33, 0, 200, 50);
        self.subTitleLab.font =  [UIFont systemFontOfSize:10];
    }else{
        self.contentView.backgroundColor = [UIColor colorWithHex:@"#ffffff"];
        self.topImgV.hidden = YES;
        self.titleLab.textColor = [UIColor colorWithHex:@"#000000"];
        self.subTitleLab.textColor = [UIColor colorWithHex:@"#BFBFBF"];
        
        self.titleLab.frame = CGRectMake(30, 0, 200, 50);
        self.subTitleLab.font =  [UIFont systemFontOfSize:10];
    }
}


@end
